import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import User from '../views/User.vue'
import Main from '../views/Main.vue'
import File from '../views/File.vue'
import PciList from '../views/PciList.vue'
import UsbList from '../views/UsbList.vue'
import Login from '../views/Login.vue'


Vue.use(VueRouter)

//将路由与组件进行映射
const routes = [
    //主路由
    {
        path: '/',
        component: Main,
        name: 'Main',
        redirect: '/home', //当路径为/时重定向到home
        children: [{
                path: '/home',
                name: 'home',
                component: Home,
                // children: [

                // ]
            },
            { path: '/user', name: 'user', component: User },
            { path: '/file', name: 'file', component: File },
            { path: '/pcilist', name: 'pcilist', component: PciList },
            { path: '/usblist', name: 'usblist', component: UsbList }
        ]

    },


    {
        path: '/login',
        name: 'login',
        component: Login
    }
]


//创建route实例，传routes配置
const router = new VueRouter({
    routes //相当于routes: routes
})

export default router //route实例进行暴露